package co.yixiang.mall.common.feign;

import co.yixiang.common.core.api.ApiResult;
import co.yixiang.common.core.constant.ServiceNameConstants;
import co.yixiang.mall.common.hystrix.RemoteOrderFallbackFactory;
import co.yixiang.mall.common.mall.domain.YxUserRecharge;
import co.yixiang.mall.common.order.domain.YxStoreOrder;
import co.yixiang.mall.common.order.vo.YxStoreOrderQueryVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 订单服务
 */
@FeignClient(contextId = "remoteOrderService", value = ServiceNameConstants.MALL_SERVICE ,fallbackFactory = RemoteOrderFallbackFactory.class)
public interface RemoteOrderService {

    /**
     * 订单详情
     */
    @GetMapping("/admin/order/detail/{key}")
    ApiResult<YxStoreOrderQueryVo> orderDetail(@PathVariable(value = "key") String key);

    /**
     * 余额支付
     * @param orderId
     * @param uid
     */
    @GetMapping("/order/yuePay")
    void yuePay(@RequestParam(value = "orderId") String orderId, @RequestParam(value = "uid") Long uid);

    /**
     * 根据订单id获取充值详情
     * @param orderId
     * @return
     */
    @GetMapping("/yxUserRecharge/getOneByOrderId")
    YxUserRecharge getOneByOrderId(@RequestParam(value = "orderId") String orderId);


    /**
     * 支付成功后操作远程调用接口
     * @param orderId 订单号
     * @param payType 支付方式
     */
    @GetMapping("/order/paySuccess")
    void paySuccess(@RequestParam(value = "orderId") String orderId,@RequestParam(value = "payType")String payType);

    /**
     * 充值远程接口
     * @param userRecharge
     */
    @PostMapping("/recharge/updateRecharge")
    void updateRecharge(@RequestBody YxUserRecharge userRecharge);

    /**
     * 根据key获取配置信息
     * @param name
     * @return
     */
    @GetMapping("/yxSystemConfig/getData")
    String getData(@RequestParam(value = "name") String name);


    /**
     * 修改订单远程调用
     * @param storeOrder
     */
    @PostMapping("/order/updateById")
    void updateById(@RequestBody YxStoreOrder storeOrder);


    /**
     * 退款扣库存
     * @param orderId
     */
    @GetMapping("/order/retrunStock")
    void retrunStock(@RequestParam(value = "orderId")String orderId);

    /**
     * 积分支付
     * @param orderId
     * @param uid
     */
    @GetMapping("/order/retrunStock")
    void integralPay(@RequestParam(value = "orderId")String orderId,@RequestParam(value = "uid") Long uid);


}
